Skip to content

Harden JavaScript native boundaries - #98

Merged
leileizhang (lei9444) merged 1 commit into
mainfrom
lei9444/js-tsfn-hardening
Aug 13, 2026
Merged

Harden JavaScript native boundaries#98
leileizhang (lei9444) merged 1 commit into
mainfrom
lei9444/js-tsfn-hardening

Conversation

@lei9444

Copy link
Copy Markdown
Contributor

Summary

  • preserve the full signed and unsigned 64-bit range across JavaScript values, arrays, and struct fields
  • convert public value, array, and struct misuse from native panics or silent coercion into JavaScript errors
  • replace delegate and progress TSFN calls with an owning, per-environment implementation that cleans rejected and teardown-drained payloads
  • bound callback queues, preserve async context for same-thread delegate dispatch, and guard Worker/environment teardown
  • add feature-gated deterministic TSFN lifecycle tests and run them in CI

Testing

  • npm run test:tsfn (11 passed)
  • npm run build && npm test (38 passed, 2 skipped)
  • cargo check -p jswinrt_rs --features test-hooks
  • cargo test -p jswinrt_rs --lib
  • cargo test -p dynwinrt test_progress_handler_marshals_u64_value

Preserve 64-bit integer values, replace public panic paths with JavaScript errors, and make delegate/progress TSFN ownership safe across queue rejection and environment teardown.

Add deterministic TSFN lifecycle tests and run them in CI.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown

Mixed-language test coverage

Workflow status: ✅ Passed

Layer Lines Functions Branches/regions
Rust, including native .pyd/.node 80.81% 77.23% 80.75% regions
Generated Python projections 77.01% n/a 62.35% branches
JavaScript aggregate 18.19% 19.58% 50.75% branches
JavaScript runtime 19.36% 14.28% 7.14% branches
Generated WinRT projections 22.27% 20.02% 52.85% branches
Generated Classic COM projections 11.25% 18.08% 45.94% branches

View workflow run and download full HTML/LCOV/XML reports

@lei9444
leileizhang (lei9444) merged commit 1577dd6 into main Aug 13, 2026
25 checks passed
@lei9444
leileizhang (lei9444) deleted the lei9444/js-tsfn-hardening branch August 13, 2026 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants